﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TestEnvirementCL.Concrete;
using TestEnvirementCL.POCO;
using System.Reflection;
namespace TestEnvirementMVC.Controllers
{
    public class SchoolController : Controller
    {
      private EFDbContext db = new EFDbContext();

      //
      // GET: /School/

      public ActionResult Index()
      {
        var schools = db.Schools.ToList<School>();
        var teams = db.Teams.ToList<Team>();

        MyChart test = new MyChart();
        String startupPath = Assembly.GetAssembly(typeof(MyChart)).Location;

        test.initialiseDataSerieArray(schools.Count);
        for (int i = 0; i < schools.Count; i++)
        {
          test.countPerName[i] = test.nieuweRij(schools[i].Name, schools[i].Teams.Count);
        }

        ViewBag.ListSchool = test.countPerName;
        ViewBag.ListTeams = teams;
        ViewBag.ListSchools = schools;
        ViewBag.Message = "Google Charts Graphs";

        return View();
      }

    }
}
